#ifndef IOFACTORY_H
#define IOFACTORY_H

#include "../IO/IO.h"
#include "IO1D.h"
#include "IO2D.h"
#include "IO3D.h"

#include "../Input/PicParams.h"
#include "../Parallel/ParallelMPI.h"
#include "../Diagnostic/Diagnostic.h"

#include "../Tool/Macros.h"


class IOFactory
{
public:

    static IO* create(PicParams* params_, ParallelMPI* pmpi_)
    {
        IO* io = NULL;
        if (params_->geometry == "1d3v")
        {
            io = new IO1D(params_, pmpi_);
        }
        else if (params_->geometry == "2d3v")
        {
            io = new IO2D(params_, pmpi_);
        }
        else if (params_->geometry == "3d3v")
        {
            io = new IO3D(params_, pmpi_);
        }
        else 
        {
            log_error<<"Geometry " << params_->geometry << " not implemented";
        }

        return io;
    }

};

#endif
